home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / Waste TCL r2 / Readme < prev   
Encoding:
Text File  |  1994-11-30  |  7.1 KB  |  143 lines  |  [TEXT/ttxt]

  1. CWASTEText Classes
  2. A set of classes for using WASTE with the Think Class Libraries
  3. by Dan Crevier
  4. Signficant contributions by Mark Alldritt
  5.  
  6. Introduction
  7.  
  8.     This is a set of classes I've written to use Marco Piovanelli's text edit replacement WASTE with the Think Class Libraries.  It only works with versions 2.0.3 or later of TCL.  It has currently been tested with WASTE 1.0a4 - 1.0.
  9.  
  10.      I wanted to use WASTE in one of my applications mainly for the ability to use more than 32K of text, and to use inline input for Japanese.  The classes are not well tested at this point, and probably contain many bugs.  I am releasing these classes as public domain, so you are free to use them as you see fit.  Remember to give Marco Piovanelli credit if you use WASTE, and you can give me some credit if you feel like it.  If you use these classes, I'd be very interested in any bug reports (especially if they include fixes) and any improvements anyone makes.  I'd like to thank Marco Piovanelli both for making WASTE available and for his help in figuring out how to get it to work with the class libraries.
  11.  
  12.      If you have used a previous version of the classes, see the what's new section.
  13.  
  14.     There are 5 classes included.  They are:
  15.      CWASTEText - a subclass of CAbstractText which is much like
  16.              CStyleText
  17.      CWASTEDlgText - a subclass of CWASTEText which is a bit like
  18.              CDialogText, but without all of the validation features.  It
  19.              has a border, broadcasts changes when the text changes,
  20.              and passes return, enter and escape to the supervisor.
  21.      CTSMSwitchboard - a subclass of CSwitchboard which deals
  22.              with Text Service Manager events.
  23.      CWASTEEditTask - a class for handling undo with CWASTEText
  24.      CWASTEStyleTask - a class for handling undo'ing style changes with CWASTEText
  25.  
  26.      I also made some slight modifications to the WASTE header files.  Hopefully Marco will be able to include these in future versions of WASTE.
  27.  
  28.      I've also included a slightly modified version of TinyEdit, called WASTEEdit, which uses WASTE as a simple example program.
  29.  
  30.      You are free to use these classes in any of your products (freeware, shareware, or commercial).
  31.  
  32. Adding WASTE Support
  33.  
  34.      If you wish to use these classes in your application, you need to add the following to your application class:
  35.  
  36.      Near the top:
  37.  
  38. #include "WASTE.h"
  39. #ifndef __SCRIPT__
  40. #include <Script.h>
  41. #endif
  42.  
  43. #include "CTSMSwitchboard.h"
  44.  
  45. static Boolean    TSMAvailable(void);
  46.  
  47. short gUsingTSM = false;
  48.  
  49.      In the constructor:
  50.  
  51.     gUsingTSM = TSMAvailable();
  52.     if (gUsingTSM) gUsingTSM = (InitTSMAwareApplication()==noErr);
  53.  
  54.      In the destructor:
  55.  
  56.     if (gUsingTSM) CloseTSMAwareApplication();
  57.  
  58.      Functions to add:
  59.  
  60. /*** make TSMSwitchboard ***/
  61. void CEditApp::MakeSwitchboard( void)
  62. {
  63.     if (gSystem.hasAppleEvents && gUsingTSM)
  64.     {
  65.         FailOSErr(WEInstallTSMHandlers());
  66.     }
  67.     itsSwitchboard = (CSwitchboard *)new CTSMSwitchboard();
  68.     itsSwitchboard->InitAppleEvents();
  69. }
  70.  
  71.  
  72. static Boolean TSMAvailable(void)
  73. {
  74.     long    response;
  75.     
  76.     return (Gestalt(gestaltTSMgrVersion, &response)==noErr);
  77. }
  78.  
  79.      To header file:
  80.  
  81. virtual void MakeSwitchboard(void);
  82.  
  83.      See WASTEEdit for an example.  Most of this stuff is to provide inline input.  Even if you don't use Japanese on your system, I recommend leaving the support there for those that do have inline input.
  84.  
  85.      You need to add CTSMSwitchboard.cpp, CWASTEText.cpp, CWASTEDlgText.cpp, CWASTEEditText.cpp, CWASTEStyleText.cpp and WASTE.o to your project.
  86.  
  87. CWASTEText
  88.  
  89.      CWASTEText is a subclass of CAbstractText, and is very similar to CStyleText.  In addition, I have added the following functions:
  90.  
  91.      StopInlineSession() - Stops the current inline input session
  92.           and validates the text.
  93.      InsertWithStyle() - Lets you insert some text and it's
  94.           corresponding StScrpHandle information all in one step.
  95.      Clear() - clears the text in the class without any excess
  96.           highlighting.
  97.      CopyRangeWithStyle() - gets the text and styles for a range
  98.           of text all in one step.
  99.      SetOutlineHighlighting() - turns outline highlighting on or off.  Returns old
  100.           setting.
  101.      SetFontNumberAll() - sets the font of all of the text.
  102.      SetFontNameAll() - sets the font of all of the text.
  103.      SetFontSizeAll() - sets the size of all of the text.
  104.      SetFontStyleAll() - applies a style to all of the text
  105.      TempSelectAll() - temporarily selects all of the text while deactivating the text
  106.           and turning off outline hilighting so that the selection won't show up.  It can
  107.           be restored by Restore selection.  This is useful when you want to apply
  108.           something to all of the text without seeing all of the text flash.  It is a
  109.           protected routine used by Clear() and the Set*All() functions.
  110.  
  111.      There are some problems with CWASTEText.  A lot of the functions haven't been tested well or at all.  Also, I should add some functions for easy color support.  TCL isn't good at supporting text without fixed height lines.  SetWholeLines(true) doesn't work well.  I set the scrolling steps to 12 vertically and 4 horizontally fow when it's in a scroll pane.  Something more intelligent could probably be done.
  112.  
  113. CWASTEDlgText
  114.  
  115.      CWASTEDlgText was made to provide some of the funcitonality of CDialogText.  A dialogTextChanged message is broadcast when the text is changed.  This wasn't easy for text being entered with inline input, but I think I have it working with a WEPostUpdate routine.  It may be broadcasting the message more often than it needs to, but that's ok with me.
  116.      It also has a border, just like CDialogText, and passes tab, return, enter, and escape to the supervisor instead of typing them.
  117.      I added the GetTextString() method to get the text into a Str255.
  118.  
  119. CTSMSwitchboard
  120.  
  121.      This is a subclass of CSwitchboard which handles Text Service Manager events.
  122.  
  123. CWASTEEditTask & CWASTEStyleTask
  124.  
  125.      These two classes were written by Mark Alldritt.  They are created by CWASTEText to take care of undoing actions and you don't need to use them directly.
  126.  
  127. WASTEEdit
  128.  
  129.      WASTEEdit is a slightly modified version of TinyEdit to get it to work with WASTE.  I tried to do the minimum modifications necessary to get it to work, so I haven't added any functionality.  With a little work, I think a nice application could be made out of it.  Right now, it's almost 10 times as big as WASTE Demo, and doesn't do quite as much.  It would be really great if someone wanted to add all the scripting support to it, so we would have a nice replacement for the Scriptable Text Editor.
  130.  
  131. What's new
  132.  
  133.      • Version 1.1
  134.      Unfortunately I haven't kept track of the changes made in the classes very well.  There were many changes, most of them for improved error checking.  Marco Piovanelli and Mark Alldritt made many contributions, and I made some changes myself.  Also, I have used the classes with my port of WASTE to C.  In the file CWASTEText.cpp, you need to define/undefine CWASTE depending on whether or not you are using the C version of WASTE.
  135.  
  136. Let me know if you have any bug fixes or problems.
  137.  
  138. Dan Crevier
  139. dan@rhino.harvard.edu
  140.  
  141.  
  142.  
  143.